//
//  MTPartyListModel.swift
//  MT
//
//  Created by ooops on 2020/5/25.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation
import ObjectMapper

enum MTPartyListTaskType: Int {
    case `default` = 0
    /// 我的任务
    case myTask = 1
    /// 报名任务
    case joinTask = 2
}

/// 聚会任务类型1招募中、2进行中、3已结束、4申请、5拒绝、6通过、7自己发布的
/// 聚会任务任务列表 - 聚会任务状态
enum MTPartyListTaskStatusType: Int {
    /// 招募中
    case wating = 1
    /// 已经开始 - 进行中
    case started = 2
    /// 已经结束
    case ended = 3
    /// 申请中 - 未通过审核
    case invite = 4
    /// 被拒绝
    case reject = 5
    /// 已通过申请
    case accept = 6
    /// 自己发布的 仅当角色是发布者时候有效 userType = 1
    case ownner = 7
}

class MTPartyListModel: Mappable {
    
    /// 请求是否成功的code
    var code: Int?
    /// 请求返回的Message
    var message: String?
    /// 分页对象
    var page: PageModel?
    /// 时间戳
    var timestamp: TimeInterval?
    
    var result: [MTPartyTaskListInfoModel]?
    
    var detailResult: MTPartyTaskListInfoModel?
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        code    <- map["code"]
        message <- map["message"]
        page <- map["page"]
        timestamp <- map["timestamp"]
        result  <- map["result"]
        detailResult  <- map["result"]
    }
}

class MTPartyTaskListInfoModel: Mappable {
    /// 聚会任务名称
    var name: String?
    /// 聚会详细描述
    var remark: String?
    var province: String?
    var city: String?
    var area: String?
    /// 俱乐部ID??
    var pushId: Int?
    /// 聚会详细地址
    var address: String?
    /// 任务类型id
    var subjectTypeId: Int?
    /// 任务类型文字
    var subjectType: Int?
    /// 匿名0否1是
    var anonymityFlag: Int?
    /// 异地成员酒店机票0否1是
    var allopatryAllopatryFlag: Int?
    /// 聚会参与人数
    var inviteNum: Int?
    /// 任务金送的礼物数量
    var giftNum: Int = 0
    /// 礼物图片
    var giftHref: String?
    /// 礼物id
    var giftId: Int = 0
    /// 聚会开始时间
    var startTime: String?
    /// 任务创建者
    var userName: String?
    /// 任务创建者昵称
    var nickname: String?
    /// 聚会主题类型名称 - 文字
    var typeName: String?
    /// 聚会任务类型1个人2商业
    var type: Int = 0
    /// 聚会任务ID
    var id: Int?
    /// 是否已经加入聚会任务
    var joined: Bool?
    /// 聚会任务状态
    var status: MTPartyListTaskStatusType = .wating
    /// 聚会任务图片
    var href: String?
    /// 发布者头像
    var userHref: String?
    var subjectTypeHref: String?
    /// 任务角色类型 - 1 发起人 2 - 报名者
    var userType: Int = 2
    /// 是否商家认证类型
    var certification: Bool = false
    /// 报名人数
    var signUserCount: Int = 0
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        signUserCount    <- map["signUserCount"]
        id    <- map["id"]
        userType    <- map["userType"]
        nickname <- map["nickname"]
        userHref <- map["userHref"]
        href    <- map["href"]
        name    <- map["name"]
        remark <- map["remark"]
        province <- map["province"]
        city <- map["city"]
        area    <- map["area"]
        pushId <- map["pushId"]
        address <- map["address"]
        subjectTypeId <- map["subjectTypeId"]
        subjectType    <- map["subjectType"]
        anonymityFlag <- map["anonymityFlag"]
        allopatryAllopatryFlag <- map["allopatryAllopatryFlag"]
        inviteNum <- map["inviteNum"]
        giftNum    <- map["giftNum"]
        giftHref <- map["giftHref"]
        giftId <- map["giftId"]
        startTime <- map["startTime"]
        userName    <- map["userName"]
        typeName <- map["typeName"]
        type <- map["type"]
        status <- map["status"]
        subjectTypeHref <- map["subjectTypeHref"]
        certification <- map["certification"]
    }
}
